#include "logger.h"
using namespace std;

namespace moqi
{

    Logger *Logger::_pInstance = nullptr;

    Logger *Logger::getInstance()
    {
        if (_pInstance == nullptr)
        {
            _pInstance = new Logger();
        }
        return _pInstance;
    }
    void Logger::destory()
    {
        if (_pInstance != nullptr)
        {
            Category::shutdown();
            delete _pInstance;
            _pInstance = nullptr;
        }
    }

    Logger::Logger() : _root(log4cpp::Category::getRoot())
    {

        std::string initFileName = "log4cpp.properties";
        log4cpp::PropertyConfigurator::configure(initFileName);
    }
    Logger::~Logger()
    {
        cout << "~Logger()" << endl;
    }
} // end of namespace moqi
